﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using WeifenLuo.WinFormsUI.Docking;

namespace pswb.Classes
{
    public enum Workspaces
    {
        PROCESS_EDITOR,
        FLOW_EDITOR
    }
    public enum WindowTypes
    {
        TOOLWINDOW,
        DOCUMENT,
        OUTPUT
    }

    public static class Workspace
    {
        private static string workspaceLoc = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\pplStuff\Workspaces";

        public static bool WorkspaceExists(Workspaces workspace)
        {
            string workspaceFile = "";
            switch (workspace)
            {
                case Workspaces.PROCESS_EDITOR:
                    workspaceFile = workspaceLoc + @"\ProcessDisigner.xml";
                    break;
                case Workspaces.FLOW_EDITOR:
                    workspaceFile = workspaceLoc + @"\FlowDesigner.xml";
                    break;
            }
            return File.Exists(workspaceFile);
        }

        public static string WorkspaceLocation(Workspaces workspace)
        {
            string workspaceFile = "";
            if (!Directory.Exists(workspaceLoc))
                Directory.CreateDirectory(workspaceLoc);
            switch (workspace)
            {
                case Workspaces.PROCESS_EDITOR:
                    workspaceFile = workspaceLoc + @"\ProcessDisigner.xml";
                    break;
                case Workspaces.FLOW_EDITOR:
                    workspaceFile = workspaceLoc + @"\FlowDesigner.xml";
                    break;
            }
            return workspaceFile;
        }

        public static DockAreas AllowedDockAreas(WindowTypes winType)
        {
            DockAreas dockAreas = DockAreas.Float;
            switch (winType)
            {
                case WindowTypes.TOOLWINDOW:
                    dockAreas = DockAreas.DockBottom | DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop | DockAreas.Float;
                    break;
                case WindowTypes.DOCUMENT:
                    dockAreas = DockAreas.Document | DockAreas.Float;
                    break;
                case WindowTypes.OUTPUT:
                    dockAreas = DockAreas.Float;
                    break;
                default:
                    break;
            }
            return dockAreas;
        }
    }
}
